package com.atguigu.lease.common.minio;

import io.minio.MinioClient;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(MinioPropeties.class)
@ConditionalOnProperty(name = "minio.endpoint")
public class minioConfig {
    @Autowired
    private MinioPropeties minioPropeties;
    @Bean
    public MinioClient minioClient(){

        return MinioClient.builder().endpoint(minioPropeties.getEndpoint()).credentials(minioPropeties.getAccessKey(),minioPropeties.getSecretKey()).build();



    }


}
